<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
            label-width="68px">
            <el-form-item label="电站名称" prop="pvName">
                <el-input v-model="queryParams.pvName" placeholder="请输入光伏电站名称" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="电站类型" prop="pvStationType">
                <el-select v-model="queryParams.pvStationType" placeholder="请选择光伏电站类型" clearable filterable>
                    <el-option v-for="dict in dict.type.pv_station_type" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                </el-select>
            </el-form-item>
            <el-form-item label="电站状态" prop="pvStationStatus">
                <el-select v-model="queryParams.pvStationStatus" placeholder="请选择光伏电站状态" clearable filterable>
                    <el-option v-for="dict in dict.type.pv_station_status" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                </el-select>
            </el-form-item>

            <el-form-item label="并网类型" prop="gridTiedType">
                <el-select v-model="queryParams.gridTiedType" placeholder="请选择并网类型" clearable filterable>
                    <el-option v-for="dict in dict.type.pv_station_grid_tied_type" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                </el-select>
            </el-form-item>

            <!-- <el-form-item label="发电户号" prop="pgaNumber">
                <el-input v-model="queryParams.pgaNumber" placeholder="请输入发电户号" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item> -->

            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                    v-hasPermi="['business:pvStation:add']">新增</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
                    v-hasPermi="['business:pvStation:edit']">修改</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
                    @click="handleDelete" v-hasPermi="['business:pvStation:remove']">删除</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['business:pvStation:export']">导出</el-button>
            </el-col>
            <!-- <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-data-analysis" size="mini"
                    @click="handleElectricityPrice">电价信息详情</el-button>
            </el-col> -->
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-data-analysis" size="mini"
                    @click="handleElectricityPriceDetail">电价信息详情</el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>

        <el-table v-loading="loading" :data="pvStationList" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="电站名称" align="center" prop="pvName" />
            <el-table-column label="电站类型" align="center" prop="pvStationType">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.pv_station_type" :value="scope.row.pvStationType" />
                </template>
            </el-table-column>
            <el-table-column label="电站状态" align="center" prop="pvStationStatus">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.pv_station_status" :value="scope.row.pvStationStatus" />
                </template>
            </el-table-column>
            <el-table-column label="装机容量" align="center" prop="installedCapacity">
                <template slot-scope="scope">
                    <span>{{ scope.row.installedCapacity }} kwp</span>
                </template>
            </el-table-column>
            <el-table-column label="经度" align="center" prop="longitude" />
            <el-table-column label="纬度" align="center" prop="latitude" />
            <el-table-column label="所在地区" align="center" prop="location" width="120" show-overflow-tooltip />
            <el-table-column label="详细地址" align="center" prop="detailAddr" width="120" show-overflow-tooltip />
            <el-table-column label="并网类型" align="center" prop="gridTiedType">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.pv_station_grid_tied_type" :value="scope.row.gridTiedType" />
                </template>
            </el-table-column>
            <el-table-column label="并网日期" align="center" prop="gridTiedDate" width="180">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.gridTiedDate, '{y}-{m}-{d}') }}</span>
                </template>
            </el-table-column>
            <el-table-column label="出资方式" align="center" prop="contributionMethod">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.pv_station_contribution_method"
                        :value="scope.row.contributionMethod" />
                </template>
            </el-table-column>
            <el-table-column label="安装日期" align="center" prop="installDate" width="180">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.installDate, '{y}-{m}-{d}') }}</span>
                </template>
            </el-table-column>
            <el-table-column label="发电户号" align="center" prop="pgaNumber" />
            <el-table-column label="组件数量" align="center" prop="componentNumber" />
            <el-table-column label="方位角" align="center" prop="azimuth">
                <template slot-scope="scope">
                    <span>{{ scope.row.azimuth }}°</span>
                </template>
            </el-table-column>
            <el-table-column label="倾斜角" align="center" prop="tiltAngle">
                <template slot-scope="scope">
                    <span>{{ scope.row.tiltAngle }}°</span>
                </template>
            </el-table-column>
            <el-table-column label="电站图片" align="center" prop="pvImageUrl">
                <template slot-scope="scope">
                    <img :src="baseUrl + scope.row.pvImageUrl" alt="" style="width: 45px;height: 45px">
                </template>
            </el-table-column>
            <el-table-column label="备注" align="center" prop="remark" />
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" fixed="right">
                <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-data-analysis"
                        @click="handleElectricityPrice(scope.row)"
                        v-hasPermi="['business:electricityPrice:add']">电价设置</el-button>
                    <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                        v-hasPermi="['business:pvStation:edit']">修改</el-button>
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                        v-hasPermi="['business:pvStation:remove']" style="color: red;">删除</el-button>
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getList" />

        <!-- 添加或修改光伏电站信息对话框 -->
        <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
            <el-form ref="form" :model="form" :rules="rules" label-width="80px">
                <el-steps :space="200" :active="activeIndex" finish-status="success">
                    <el-step title="电站信息"></el-step>
                    <el-step title="电价信息"></el-step>
                </el-steps>
                <el-row :gutter="10" v-show="activeIndex == 1">
                    <el-col :span="12">
                        <el-form-item label="电站名称" prop="pvName">
                            <el-input v-model="form.pvName" placeholder="请输入光伏电站名称" maxlength="80" min="2"
                                show-word-limit />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="电站类型" prop="pvStationType">
                            <el-select v-model="form.pvStationType" placeholder="请选择光伏电站类型" filterable
                                style="width: 100%;">
                                <el-option v-for="dict in dict.type.pv_station_type" :key="dict.value"
                                    :label="dict.label" :value="dict.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="电站状态" prop="pvStationStatus">
                            <el-radio-group v-model="form.pvStationStatus">
                                <el-radio v-for="dict in dict.type.pv_station_status" :key="dict.value"
                                    :label="dict.value">{{
                                        dict.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="装机容量" prop="installedCapacity">
                            <el-input-number v-model="form.installedCapacity" placeholder="请输入装机容量，单位kWp 千瓦时"
                                maxlength="8" show-word-limit style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="经度" prop="longitude">
                            <el-input-number v-model="form.longitude" placeholder="请输入经度" :precision="6" :step="0.1"
                                :max="999" style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="纬度" prop="latitude">
                            <el-input-number v-model="form.latitude" placeholder="请输入纬度" :precision="6" :step="0.1"
                                :max="999" style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="所在地区" prop="location">
                            <el-input v-model="form.location" placeholder="请输入电站所在地区" maxlength="50" show-word-limit />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="详细地址" prop="detailAddr">
                            <el-input v-model="form.detailAddr" placeholder="请输入电站详细地址" maxlength="150"
                                show-word-limit />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="并网类型" prop="gridTiedType">
                            <el-select v-model="form.gridTiedType" placeholder="请选择并网类型" filterable
                                style="width: 100%;">
                                <el-option v-for="dict in dict.type.pv_station_grid_tied_type" :key="dict.value"
                                    :label="dict.label" :value="dict.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="并网日期" prop="gridTiedDate">
                            <el-date-picker clearable v-model="form.gridTiedDate" type="date" value-format="yyyy-MM-dd"
                                placeholder="请选择并网日期" style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="出资方式" prop="contributionMethod">
                            <el-select v-model="form.contributionMethod" placeholder="请选择出资方式" filterable
                                style="width: 100%;">
                                <el-option v-for="dict in dict.type.pv_station_contribution_method" :key="dict.value"
                                    :label="dict.label" :value="dict.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="安装日期" prop="installDate">
                            <el-date-picker clearable v-model="form.installDate" type="date" value-format="yyyy-MM-dd"
                                placeholder="请选择安装日期" style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="发电户号" prop="pgaNumber">
                            <el-input v-model="form.pgaNumber" placeholder="请输入发电户号" maxlength="20" show-word-limit />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="组件数量" prop="componentNumber">
                            <el-input-number v-model="form.componentNumber" placeholder="请输入组件数量"
                                style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="方位角" prop="azimuth">
                            <el-input-number v-model="form.azimuth" placeholder="请输入方位角，0-360°" :precision="1"
                                :step="0.1" :max="360" style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="倾斜角" prop="tiltAngle">
                            <el-input-number v-model="form.tiltAngle" placeholder="请输入倾斜角，0-90°" :precision="1"
                                :step="0.1" :max="90" style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="电站图片" prop="pvImageUrl">
                            <!-- <el-input v-model="form.pvImageUrl" placeholder="请输入电站图片" /> -->
                            <stationImage @getStationImage="getStationImage" ref="stationImage"
                                :pvImageUrl="form.pvImageUrl" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="备注" prop="remark">
                            <el-input type="textarea" v-model="form.remark" placeholder="请输入备注" maxlength="300"
                                show-word-limit />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="10" v-show="activeIndex == 2">
                    <el-col :span="12">
                        <el-form-item label="用电电价类型" prop="electricityPriceType" label-width="100px">
                            <el-radio-group v-model="form.electricityPriceType" @input="handlerElectricityPriceType">
                                <el-radio-button v-for="dict in dict.type.pv_station_electricity_price_class"
                                    :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio-button>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" v-show="form.electricityPriceType == '10'">
                        <el-form-item label="用电电价" prop="electricityPrice">
                            <el-input-number v-model="form.electricityPrice" placeholder="请输入用电电价，单位元/kWh"
                                :precision="2" :step="0.1" :max="90" style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="24" v-if="form.electricityPriceType == '11'">
                        <ElectricityPriceTable @getElectricityPriceList="getElectricityPriceList" />
                    </el-col>
                    <el-col :span="24">

                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="上网电价类型" prop="gridElectricityPriceType" label-width="100px">
                            <el-radio-group v-model="form.gridElectricityPriceType"
                                @input="handlerGridElectricityPriceType">
                                <el-radio-button v-for="dict in dict.type.pv_station_electricity_price_class"
                                    :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio-button>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" v-if="form.gridElectricityPriceType == '10'">
                        <el-form-item label="上网电价" prop="gridElectricityPrice">
                            <el-input-number v-model="form.gridElectricityPrice" placeholder="请输入上网电价，单位元/kWh"
                                :precision="2" :step="0.1" :max="90" style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :span="12" v-if="form.gridElectricityPriceType == '11'">
                        <el-button type="primary" @click="handlerAddGridPriceDate">新增日期</el-button>
                    </el-col> -->
                    <el-col :span="24" v-if="form.gridElectricityPriceType == '11'">
                        <GridElectricityPriceTable @getGridElectricityPriceList="getGridElectricityPriceList" />
                    </el-col>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" icon="el-icon-d-arrow-left" @click="prev">上一步</el-button>
                <el-button type="primary" icon="el-icon-d-arrow-right" @click="next">下一步</el-button>
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
        </el-dialog>

        <el-drawer title="电价信息" :visible.sync="drawer" direction="rtl" class="electricityPriceInfo"
            @close="closeDrawer">
            <ElectricityPriceInfo :drawer="drawer" @changeDrawer="changeDrawer" />
        </el-drawer>
    </div>
</template>

<script>
import { listPvStation, getPvStation, delPvStation, addPvStation, updatePvStation, getPriceListByPvStationId } from "@/api/business/pvStation"
import stationImage from "./stationImage.vue";
import ElectricityPriceTable from "./electricityPriceTable.vue";
import GridElectricityPriceTable from "./gridElectricityPriceTable.vue";
import ElectricityPriceInfo from "./electricityPrice.vue";
export default {
    name: "PvStation",
    dicts: ['pv_station_type', 'pv_station_status', 'pv_station_grid_tied_type', 'pv_station_contribution_method', 'pv_station_electricity_price_type', 'pv_station_electricity_price_class'],
    components: { stationImage, ElectricityPriceInfo, ElectricityPriceTable, GridElectricityPriceTable },
    data() {
        return {
            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 光伏电站信息表格数据
            pvStationList: [],
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 电价信息
            drawer: false,
            // 默认路径
            baseUrl: process.env.VUE_APP_BASE_API,
            // 步骤条
            activeIndex: 1,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                pvName: null,
                pvStationType: null,
                pvStationStatus: null,
                installedCapacity: null,
                longitude: null,
                latitude: null,
                location: null,
                detailAddr: null,
                gridTiedType: null,
                gridTiedDate: null,
                contributionMethod: null,
                installDate: null,
                pgaNumber: null,
                componentNumber: null,
                azimuth: null,
                tiltAngle: null,
                pvImageUrl: null,
            },
            // 表单参数
            form: {},
            // 表单校验
            rules: {
                pvName: [
                    { required: true, message: "光伏电站名称不能为空", trigger: "blur" }
                ],
                pvStationType: [
                    { required: true, message: "光伏电站类型不能为空", trigger: "change" }
                ],
                pvStationStatus: [
                    { required: true, message: "光伏电站状态不能为空", trigger: "change" }
                ],
                installedCapacity: [
                    { required: true, message: "装机容量，单位kWp 千瓦时不能为空", trigger: "blur" }
                ],
                longitude: [
                    { required: true, message: "经度不能为空", trigger: "blur" }
                ],
                latitude: [
                    { required: true, message: "纬度不能为空", trigger: "blur" }
                ],
                location: [
                    { required: true, message: "电站所在地区不能为空", trigger: "blur" }
                ],
                detailAddr: [
                    { required: true, message: "电站详细地址不能为空", trigger: "blur" }
                ],
                gridTiedType: [
                    { required: true, message: "并网类型不能为空", trigger: "change" }
                ],
                gridTiedDate: [
                    { required: true, message: "并网日期不能为空", trigger: "blur" }
                ],
                contributionMethod: [
                    { required: true, message: "出资方式不能为空", trigger: "blur" }
                ],
                createBy: [
                    { required: true, message: "创建人不能为空", trigger: "blur" }
                ],
                createTime: [
                    { required: true, message: "创建时间不能为空", trigger: "blur" }
                ]
            },
            tableData: [{
                date: '2016-05-02',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            }, {
                date: '2016-05-04',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1517 弄'
            }, {
                date: '2016-05-01',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1519 弄'
            }, {
                date: '2016-05-03',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1516 弄'
            }],
            // 用电电价分段列表
            electricityPriceList: [],
            electricityPriceListNum: 1,
            // 上网电价分段列表
            gridElectricityPriceList: [],
            gridElectricityPriceListNum: 1,
            pvStationId: null,
        }
    },
    created() {
        this.getList()
    },
    methods: {
        /** 查询光伏电站信息列表 */
        getList() {
            this.loading = true
            listPvStation(this.queryParams).then(response => {
                this.pvStationList = response.rows
                this.total = response.total
                this.loading = false
            })
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
            this.$refs.stationImage.clearStationFiles();
        },
        // 获取电站图片
        async getStationImage(files) {
            try {
                const base64 = await this.fileToBase64(files[0]);
                this.form.params.imageBase64String = base64;
            } catch (error) {
                console.error('转换失败:', error);
            }
        },
        prev() {
            if (this.activeIndex == 2) {
                this.activeIndex--
            }
        },
        next() {
            this.$refs["form"].validate(valid => {
                if (valid) {
                    if (this.activeIndex == 1) {
                        this.activeIndex++
                    }
                }
            })
        },
        // 用电电价类型修改为固定时，清空分时数据
        handlerElectricityPriceType() {
            if (this.form.params && this.form.electricityPriceType == '10') {
                this.form.params.electricityPriceList = null
            }
        },
        // 上网电价类型修改为固定时，清空分时数据
        handlerGridElectricityPriceType() {
            if (this.form.params && this.form.gridElectricityPriceType == '10') {
                this.form.params.gridElectricityPriceList = null
            }
        },

        // 获取用电电价分段列表数据
        getElectricityPriceList(data) {
            console.log(data);
            this.form.params.electricityPriceList = data;
        },
        getGridElectricityPriceList(data) {
            console.log(data);
            this.form.params.gridElectricityPriceList = data;
        },
        // 表单重置
        reset() {
            this.form = {
                pvId: null,
                pvName: null,
                pvStationType: null,
                pvStationStatus: '10',
                installedCapacity: null,
                longitude: null,
                latitude: null,
                location: null,
                detailAddr: null,
                gridTiedType: null,
                gridTiedDate: null,
                contributionMethod: null,
                installDate: null,
                pgaNumber: null,
                componentNumber: null,
                azimuth: null,
                tiltAngle: null,
                pvImageUrl: null,
                remark: null,
                updateBy: null,
                updateTime: null,
                createBy: null,
                createTime: null,
                params: {
                    imageBase64String: null
                },
                electricityPriceType: '10',
                electricityPrice: null,
                gridElectricityPriceType: '10',
                gridElectricityPrice: null,
                params: {
                    priceId: null,
                    gridElectricityPriceClass: null,
                    gridElectricityPrice: null,
                    gridElectricityPriceList: null,
                    electricityPriceClass: null,
                    electricityPrice: null,
                    electricityPriceList: null,
                }
            }
            this.resetForm("form");
            this.activeIndex = 1;
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1
            this.getList()
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm")
            this.handleQuery()
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map(item => item.pvId)
            this.single = selection.length !== 1
            this.multiple = !selection.length
        },
        /** 新增按钮操作 */
        handleAdd() {
            this.reset();
            this.open = true
            this.title = "添加光伏电站信息"
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.reset();
            const pvId = row.pvId || this.ids
            let datas = {}
            getPvStation(pvId).then(response => {
                this.form = response.data;
                getPriceListByPvStationId(pvId).then(res => {
                    if (res.code == 200) {
                        this.form.params = res.data;
                        this.open = true;
                    }
                })
                this.title = "修改光伏电站信息"
            })
        },
        /** 提交按钮 */
        submitForm() {
            this.form.params.electricityPriceClass = this.form.electricityPriceType;
            this.form.params.gridElectricityPriceClass = this.form.gridElectricityPriceType;
            this.form.params.electricityPrice = this.form.electricityPrice;
            this.form.params.gridElectricityPrice = this.form.gridElectricityPrice;
            this.$refs["form"].validate(valid => {
                if (valid) {
                    if (this.form.pvId != null) {
                        updatePvStation(this.form).then(response => {
                            this.$modal.msgSuccess("修改成功")
                            this.open = false
                            this.getList()
                        })
                    } else {
                        addPvStation(this.form).then(response => {
                            this.$modal.msgSuccess("新增成功")
                            this.open = false
                            this.getList()
                        })
                    }
                }
            })
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            const pvIds = row.pvId || this.ids
            this.$modal.confirm('是否确认删除光伏电站信息编号为"' + pvIds + '"的数据项？').then(function () {
                return delPvStation(pvIds)
            }).then(() => {
                this.getList()
                this.$modal.msgSuccess("删除成功")
            }).catch(() => { })
        },
        /** 导出按钮操作 */
        handleExport() {
            this.download('business/pvStation/export', {
                ...this.queryParams
            }, `pvStation_${new Date().getTime()}.xlsx`)
        },
        // 打开电价设置
        handleElectricityPrice(row) {
            this.drawer = true;
            this.pvStationId = row.pvId;
        },
        // 关闭电价设置页面
        closeDrawer() {
            this.drawer = false;
        },
        changeDrawer(isDrawer) {
            this.drawer = isDrawer;
        },
        // 站点电价信息详情
        handleElectricityPriceDetail() {
            this.$router.push('/business/electricity-price-detail/index')
        },

    }
}
</script>
<style lang="scss" scoped>
::v-deep.electricityPriceInfo .el-drawer__open .el-drawer.rtl {
    width: 100% !important;
}
</style>
